package com.zxbg.controller.systemtoolsController;

import com.zxbg.controller.Code;
import com.zxbg.controller.Result;
import com.zxbg.service.systemtoolsService.SecurityManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/SecurityManagement")
public class SecurityManagementController {
    @Autowired
    SecurityManagementService securityManagementService;

    @GetMapping
    public Result getAllSettingsMap(@RequestHeader Integer tenant_id) {
        return new Result(Code.GET_OK, securityManagementService.getAllSettingsMap(tenant_id));
    }

    @PutMapping
    public Result setSetting(@RequestBody Map<String, String> map, @RequestHeader Integer tenant_id) {
        return new Result(Code.UPDATE_OK, securityManagementService.setSetting(map.get("type"), map.get("value"), tenant_id));
    }
}
